/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
/**
 * @file created by sch 2018/11/27
 */

import Validator from '../validation/validator';
import { trim } from 'src/util/format';

export default class Email extends Validator {
    verify (value) {
        const EMAIL_REG = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
        value = trim(value);
        if (!EMAIL_REG.test(value)) {
            return _('请输入正确的邮箱，例如:zhangsan@zhang.com');
        }
        return true;
    }
};
